import 'package:dio/dio.dart';
import 'package:x3_base_core/base_models/base_http_result_model.dart';

/// 设置响应的数据
class BaseResponseInterceptor extends InterceptorsWrapper {

  @override
  void onResponse(Response response, ResponseInterceptorHandler handler) {
    if (response.statusCode == 200 || response.statusCode == 201) {
      response.data = new BaseHttpResultModel(response.statusCode, true, response.data, null, null);
    } else {
      response.data = BaseHttpResultModel(response.statusCode, false, response.data, null, null);
    }
    super.onResponse(response, handler);
  }

}
